<?php
declare (strict_types=1);

namespace app\exam\service;

use think\facade\Request;
use app\common\service\BaseService;
use app\exam\logic\Common as CommonLogic;
use app\exam\logic\Topic as TopicLogic;
use app\exam\logic\TopicPracticeRecord;
use app\exam\logic\TopicCollect;

/**
 * 公共接口类
 *
 * @package app\exam\service
 */
class Common extends BaseService
{

	/**
	 * 获取试题信息及选项
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-02-04
	 * @return [type] [description]
	 */
	public function getTopicInfo()
	{
		$param = Request::get();
		$data  = app(TopicLogic::class)->getTopicInfo($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 获取错题本列表
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-03-05
	 * @return [type] [description]
	 */
	public function getWrongTopicList()
	{
		$param = Request::get();
		$data  = app(TopicPracticeRecord::class)->getWrongTopicList($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 获取错题信试题息
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-03-05
	 * @return [type] [description]
	 */
	public function getWrongTopic()
	{
		$param = Request::get();
		$data  = app(TopicPracticeRecord::class)->getWrongTopic($param);

		return $this->parseToData($data, 1, '获取成功');
	}

	/**
	 * 提交错题本试题答案
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-04-22
	 * @return [type] [description]
	 */
	public function postTopicAnswer()
	{
		$param = Request::post();
		$data  = app(TopicPracticeRecord::class)->postTopicAnswer($param);

		return $this->parseToData($data, 1, '操作成功');
	}

	/**
	 * 收藏题目
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-03-05
	 * @return [type] [description]
	 */
	public function collectTopic()
	{
		$param = Request::post();
		$data  = app(TopicCollect::class)->collectTopic($param);

		return $this->parseToData($data, 1, '操作成功');
	}

	/**
	 * 收藏列表
	 * Author 亓官雨树<lucky.max@foxmail.com>
	 * Date 2021-03-18
	 * @return [type] [description]
	 */
	public function getCollectList()
	{
		$param = Request::get();
		$data  = app(TopicCollect::class)->getCollectList();

		return $this->parseToData($data, 1, '获取成功');
	}
}
